package com.atgm.mall.gmmailware.controller;

import com.atgm.common.utils.R;
import com.atgm.mall.gmmailware.service.WareGameService;
import com.atgm.mall.gmmailware.vo.req.WareGameReqVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/gmmallware/waregame")
public class WareGameController {

    @Autowired
    private WareGameService wareGameService;

    @PostMapping("/lock/order")
    public R lockOrder(@RequestBody WareGameReqVo wareGameReqVo) {
        wareGameService.lockOrderInfo(wareGameReqVo);
        return R.ok();
    }

    /**
     * 解锁订单库存
     * @param orderSn
     * @return
     */
    @GetMapping("/unlock/{orderSn}")
    public R unlockOrder(@PathVariable("orderSn") String orderSn) {
        wareGameService.unlockOrderInfo(orderSn);
        return R.ok();
    }
}
